-- slime_event
-- created by panyl
-- 地牢格子：隐藏冈布奥

return {
    autoFight = function(grid)
        local pos = grid:getPos();
        local dbase = DungeonM.query(grid.class, "dbase");
        local eventIds = dbase["slime_events"] or {};
        if type(eventIds) ~= "table" then
            -- 没有可以触发的类型
            return false;
        end

        local dungeonId = DungeonM.getDungeonId();
        local layer = DungeonM.currentLayer();
        if DungeonBossM.isBossLayer(dungeonId, layer)
            and not DungeonM.isAllMonsterDead() then
            -- boss层要等boss被击杀
            return false;
        end

        for _, eventId in pairs(eventIds) do
            if DungeonActionM.go("slime_event", pos, eventId) then
                return true;
            end
        end
        return false;
    end,
};
